const { merge } = require('webpack-merge');
const baseCfg = require('./webpack.base');
const DllReferencePlugin = require('webpack/lib/DllReferencePlugin');
const path = require('path');
const dllPath = path.join(__dirname,'./dist/dll');

const devCfg= {
  mode: 'development',
  devServer: {
    overlay: true,
    watchOptions: {
      aggregateTimeout: 300,
      poll: 1000,
    },
    hot: true,
  },
  module: {
    rules: [
      {
        test: /\.css$/,
        use: ['style-loader', 'css-loader', 'postcss-loader',],
      },
      {
        test: /\.less$/,
        use: ['style-loader', 'css-loader', 'less-loader']
      },
      {
        test: /\.(png|jpe?g|gif)$/i,
        use:['file-loader']
      }
    ]
  },
  plugins : [
    new DllReferencePlugin({
      manifest: require(path.join(dllPath,'./react.manifest.json'))
    }),
  ]
}
module.exports = merge(baseCfg, devCfg);